package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_fInvrhedDS {
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;
	
	
	public ASM_fInvrhedDS(Context context) {
		this.context = context;
		dbHelper  = new ASM_DB(context);
		
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	
	public int Create(ASM_fInvrhed det) 
	{
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		
		ContentValues values = new ContentValues();
		
		values.put(ASM_DB.asmInvrhed_RefNo, det.getAsmInvrhed_RefNo());
		values.put(ASM_DB.asmInvrhed_TxnDate, det.getAsmInvrhed_TxnDate());
		values.put(ASM_DB.asmInvrhed_RefNo1, det.getAsmInvrhed_RefNo1());
		values.put(ASM_DB.asmInvrhed_TxnType, det.getAsmInvrhed_TxnType());
		values.put(ASM_DB.asmInvrhed_RepCode, det.getAsmInvrhed_RepCode());
		values.put(ASM_DB.asmInvrhed_BTotalAmt, det.getAsmInvrhed_BTotalAmt());
		values.put(ASM_DB.asmInvrhed_DebCode, det.getAsmInvrhed_DebCode());
		values.put(ASM_DB.asmInvrhed_AreaCode, det.getAsmInvrhed_AreaCode());
		
		values.put(ASM_DB.asmInvrhed_Invflg, det.getAsmInvrhed_Invflg());
		values.put(ASM_DB.asmInvrhed_Remarks, det.getAsmInvrhed_Remarks());
		values.put(ASM_DB.asmInvrhed_LocCode, det.getAsmInvrhed_LocCode());


		
		count = (int) dB.insert(ASM_DB.ASM_FINVRHED, null, values);

		dB.close();
		return count;
		
	}
}
